package com.magic.shop.module;

import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Component;
import org.ssssssss.magicapi.core.annotation.MagicModule;

import java.util.concurrent.TimeUnit;

/**
 * @author zhangbo
 * @create 2024/10/8
 */
@Component
@Slf4j
@MagicModule("zbRedisModule")
public class CustomerRedisModule {
    @Autowired
    private RedisTemplate redisTemplate; // 创建静态引用类

//    @Autowired
//    public void setSredisTemplate(StringRedisTemplate redisRepository) {
//        this.sredisTemplate = redisRepository;
//
//    }

     public  void setValueAndTime(String key,Object value,long times){
         redisTemplate.opsForValue().set(key, value, times, TimeUnit.SECONDS);
     }
}
